package com.everfro.codeshare.dialog;


import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;

public class SendDialogPage extends WizardPage {

	
	public String codetoSend = "";
	public Combo expiresCombo;
	public Text codeToSend;
	public Text comments;
	
	private String[] timeSpan = {"1 day(s)", "2 day(s)", "3 day(s)", "4 day(s)", "5 day(s)", "6 day(s)", "1 week(s)", "2 week(s)", "3 week(s)", "4 week(s)", "5 week(s)", "6 week(s)" , "7 week(s)", "8 week(s)"};
	
	protected SendDialogPage(String pageName, String codeToSend) {
		super(pageName);
		this.codetoSend = codeToSend;
		//setDescription("Select how long you would like this code to be available and any description you would like to assign to this code before sending");
		
	}

	public void createControl(Composite parent) {
		Composite container = new Composite(parent, SWT.NULL);
		GridLayout layout = new GridLayout();
		layout.makeColumnsEqualWidth = false;
		container.setLayout(layout);
		layout.numColumns = 2;
		
		//Add Label
		GridData gridData1 = new GridData();
		gridData1.verticalAlignment = org.eclipse.swt.layout.GridData.BEGINNING;
		Label CodeToSendLabel = new Label(container, SWT.NONE);
		CodeToSendLabel.setText("Code:");
		CodeToSendLabel.setLayoutData(gridData1);
		
		//Add text dialog
		GridData gridData = new GridData(GridData.GRAB_HORIZONTAL, GridData.VERTICAL_ALIGN_END);
		
		//gridData.widthHint = 300;
		gridData.heightHint = 200;
	
		
		codeToSend = new Text(container, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER | SWT.SHADOW_ETCHED_IN);
		codeToSend.setLayoutData(gridData);
		codeToSend.setText(this.codetoSend);
	
		
		//Another label for the drop down
		Label lblDisplayFor = new Label(container, SWT.NONE);
		lblDisplayFor.setText("Expires:");
		
		
		//Add dates
		
		expiresCombo = new Combo(container, SWT.NONE|SWT.READ_ONLY);
		expiresCombo.setItems(timeSpan);
		expiresCombo.select(0);
		
		GridData gridData4 = new GridData();
		gridData4.verticalAlignment = org.eclipse.swt.layout.GridData.BEGINNING;
		Label lblComment = new Label(container, SWT.NONE);
		lblComment.setText("Comments:");
		lblComment.setLayoutData(gridData4);
		
		
//		Add text dialog
		GridData gridData3 = new GridData();
		gridData3.heightHint = 50;
		gridData3.widthHint = 300;
		gridData3.grabExcessHorizontalSpace = true;
		
		comments = new Text(container, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL| SWT.BORDER);
		comments.setLayoutData(gridData3);
		
		
		setControl(container);
	}

}  //  @jve:decl-index=0:visual-constraint="77,77"
